#{extends 'main.html' /} #{set title:'UserProfile' /}
<head>
<script type="text/javascript">
	$(function() {
		javascript: showNotificationsBID(0);
		javascript: showRequests();
		$("#tabs").tabs();
		$("#notT").tabs();
		$("#notTabs").tabs();
		javascript: fillUserInfo();
		javascript: editUserInfo();
		document.getElementById('requestsDiv').innerHTML = "";
		javascript: showNotificationList();
		javascript: checkSystemAdmin();
	});
</script>
<script type="text/javascript">
	function showNotificationsBID(initial) {
		$('#NotificationListB').fadeIn(2000);
		$
				.getJSON(
						'@{usersController.DisplayNotificationSID()}',
						{
							'userName' : "username"
						},
						function(data) {
							if (data != null
									&& data.result == "sizeNotEqualZero") {
								var list = {};
								list = data.list.split("&&");
								var total = "";
								if (document
										.getElementById("NotificationListB").innerHTML == "")
									var total = "<h3><span>&ndash; </span>Notifications</h3>";

								//<p><a href='#' onclick=\"show_iDev('"+ innerList[0]+ "')\">"+ innerList[0]+ "</a> "+innerList[1]+"</p>
								var maximum = (list.length - 1 > initial + 5) ? (initial + 5)
										: (list.length - 1);
								for ( var i = initial; i < maximum; i = i + 1) {

									var innerList = {};
									innerList = list[i].split(",,,");
									   total += "<li><div style=\"overflow:hidden;\"><p style=\"width:300px ;padding-bottom:0px; margin-bottom:0px;\">"
                            + innerList[0]
                            + " "
                            + innerList[1]+"         "+"<p style=\"float:right;\">"+displayNotTag(innerList[1])+" "+ timeDifference(new Date().getTime(), innerList[2])+" "+ "</p></p></div></li>";

								}
								//total += "</ul>";
								if (maximum < (list.length - 1)) {
									document
											.getElementById("NotificationListBC").innerHTML = "<button onclick=\"showNotificationsBID("
											+ maximum
											+ ")\">Show More</button>";
								} else {
									document
											.getElementById("NotificationListBC").innerHTML = "";
								}
								document.getElementById("NotificationListB").innerHTML += total;
							} else {
								//alert("No Notifications available ");
							}
						});
	}
</script>
<script type="text/javascript">
function getTagsghUSER(search) {

	if (search != "") {
		$(function() {
			$.getJSON('@{QuickSearchRendering.autoComplete1()}', {
				'search' : search
			}, function(data) {
				$("#invitedUsername").autocomplete({
					source : data.tags.split("&")
				});
			});

		});
	}
}

</script>
     <script type="text/javascript">
              function displayNotTag(current) {
             if(current.match("idea") != null ||current.match("Idea") != null ){return "<a  style=\"background: grey url('../../public/images/light.png') center center repeat-x; color: black; margin: 0px; padding: 0px 0px 1px 1px; text-decoration: none; border-radius: 4px; font-size: 12px; float: right;\"> idea</a>";
             }
             else { if(current.match("entity") != null ||current.match("Entity") != null ){return "<a  style=\"background: red url('../../public/images/light.png') center center repeat-x; color: white; margin: 0px; padding: 0px 0px 1px 1px; text-decoration: none; border-radius: 4px; font-size: 12px; float: right;\"> entity</a>";

             } else { if(current.match("organization") != null ||current.match("Organization") != null ){return "<a  style=\"background: green  url('../../public/images/light.png') center center repeat-x; color: white; margin: 0px; padding: 0px 0px 1px 1px; text-decoration: none; border-radius: 4px; font-size: 12px; float: right;\"> organization</a>";
                     }
                     else { if(current.match("topic") != null || current.match("Topic") != null){return "<a  style=\"background: blue  url('../../public/images/light.png') center center repeat-x; color: white; margin: 0px; padding: 0px 0px 1px 1px; text-decoration: none; border-radius: 4px; font-size: 12px; float: right;\"> topic</a>";
                     }
                     { if(current.match("actionPlan") != null || current.match("ActionPlan") != null){return "<a  style=\"background: pink  url('../../public/images/light.png') center center repeat-x; color: white; margin: 0px; padding: 0px 0px 1px 1px; text-decoration: none; border-radius: 4px; font-size: 12px; float: right;\"> ActionPlan</a>";
                     }else {return "";}
              }
             }
             }
              }
              }
         </script>
     <script type="text/javascript">
        function timeDifference(current, previous) {

    var msPerMinute = 60 * 1000;
    var msPerHour = msPerMinute * 60;
    var msPerDay = msPerHour * 24;
    var msPerMonth = msPerDay * 30;
    var msPerYear = msPerDay * 365;

    var elapsed = current - previous;

    if (elapsed < msPerMinute) {
         return Math.round(elapsed/1000) + ' seconds ago';
    }

    else if (elapsed < msPerHour) {
         return Math.round(elapsed/msPerMinute) + ' minutes ago';
    }

    else if (elapsed < msPerDay ) {
         return Math.round(elapsed/msPerHour ) + ' hours ago';
    }

    else if (elapsed < msPerMonth) {
        return  Math.round(elapsed/msPerDay) + ' days ago';
    }

    else if (elapsed < msPerYear) {
        return  Math.round(elapsed/msPerMonth) + ' months ago';
    }

    else {
        return  Math.round(elapsed/msPerYear ) + ' years ago';
    }
}

    </script>
<script type="text/javascript">
	function checkSystemAdmin() {
		$
				.getJSON(
						'@{UserProfile.isAdmin()}',
						{},
						function(data) {
							if (data.admin == true) {
								document.getElementById("systemAdminDiv").innerHTML = "<h3>To go to the system admin view <a href=\"http://localhost:9000/admin\">click here</a> !</h3>";
							}
						});
	}
</script>

<script type="text/javascript">
	function showRequests() {
		$
				.getJSON(
						'@{UserProfile.loadRequests()}',
						{},
						function(data) {
							//alert(data.result);
							if (data != null) {
								//&& data.result == "sizeNotEqualZero") {
								var reqList = {};
								reqList = data.list.split('AAA');
								//alert(reqList[0]);
								var total = "<p><table id=\"beOrgTable\" border=\"0\"><th>Inviter</th><th>Type</th><th></th>";
								for ( var i = 0; i < reqList.length - 1; i = i + 1) {
									var innerList = {};
									innerList = reqList[i].split(',,,');

									total += "<tr>";
									total += "<td>";
									total += "<label>" + innerList[0]
											+ "</label>"
									//total += "<p> <input type=\"label\" value=\"" + innerList[0] + "\" > </p>"; // can be a href !!
									total += "</td>";

									total += "<td>";
									total += "<label>" + innerList[1]
											+ "</label>"
									//total += "<p> <input type=\"label\" value=\"" + innerList[1] + "\" > </p>";
									total += "</td>";

									total += "<td>";
									total += "<input type=\"button\" id=\"acceptInvitationBtn"
											+ i
											+ "\" value=\" Accept \" onclick=\"replyInvitation("
											+ innerList[2]
											+ ","
											+ true
											+ ")\" >";

									total += "<label>    <label><input type=\"button\" id=\"declineInvitationBtn"
											+ i
											+ "\" value=\" decline \" onclick=\"replyInvitation("
											+ innerList[2]
											+ ","
											+ false
											+ ")\" >";
									total += "</td>";

									total += "</tr>";

								}
								total += "</table>";

								document.getElementById("requestsDiv").innerHTML = total;
								if (data.result == "sizeEqualZero") {
									document.getElementById("requestsDiv").innerHTML = "<h3>You currently have no requests</h3>";
								}
							} else {
								//alert("No current invitations to be organizer ");
							}

						});
	}

	function showNotificationList() {
		////////////////////////////getFollowed\\\\\\\\\\\\\\\\\\\\\\\\\\\\
		$
				.getJSON(
						'@{UserProfile.getFollowedOrganizations()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"followedOrgDiv\"><table><th>Organizations followed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkFO"+i+"\" CHECKED name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("followedOrgCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML = division;
							}
						});
		if (document.getElementById("followedOrgCounter").value == "0") {
			document.getElementById("followingDiv").innerHTML = "";
		}
		$
				.getJSON(
						'@{UserProfile.getFollowedEntities()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"followedOrgDiv\"><table><th>Entities followed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkFE"+i+"\" CHECKED name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("followedEntCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}
						});
		$
				.getJSON(
						'@{UserProfile.getFollowedTopics()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"followedTopDiv\"><table><th>Topics followed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkFT"+i+"\" CHECKED name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("followedTopCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}

						});
		$
				.getJSON(
						'@{UserProfile.getFollowedTags()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"followedTagDiv\"><table><th>Tags followed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkFTA"+i+"\" CHECKED name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("followedTagCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}
						});
		////////////////////////////getUnfollowed\\\\\\\\\\\\\\\\\\\\\\\\\\\\
		$
				.getJSON(
						'@{UserProfile.getUnfollowedOrganizations()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"unfollowedOrgDiv\"><table><th>Organizations unfollowed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkUFO"+i+"\" name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("unfollowedOrgCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}
						});
		$
				.getJSON(
						'@{UserProfile.getUnfollowedEntities()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"unfollowedEntDiv\"><table><th>Entities unfollowed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkUFE"+i+"\" name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("unfollowedEntCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}
						});
		$
				.getJSON(
						'@{UserProfile.getUnfollowedTopics()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"unfollowedTopDiv\"><table><th>Topics unfollowed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkUFT"+i+"\" name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("unfollowedTopCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}
						});
		$
				.getJSON(
						'@{UserProfile.getUnfollowedTags()}',
						function(data) {
							if (data.result != "^") {
								var list = data.result.split("&&");
								var division = "<div id=\"unfollowedTagDiv\"><table><th>Tags unfollowed</th>";
								var innerList = [];
								for ( var i = 0; i < list.length; i++) {
									innerList = list[i].split(",");
									if (list[i] != "") {
										division += "<tr><td>"
												+ innerList[1]
												+ "<input type=\"checkbox\" id=\"checkUFTA"+i+"\" name=\"option1\" value=\""+innerList[0]+"\">"
												+ "</td></tr>";
										document
												.getElementById("unfollowedTagCounter").value = list.length - 1;
									}
								}
								division += "</table>";
								division += "</div>";
								document.getElementById("followingDiv").innerHTML += division;
							}
						});
	}

	function followThing() {

		var maximum = parseInt(document.getElementById("followedOrgCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkFO' + i + '').checked;
			var id = document.getElementById("checkFO" + i + "").value;
			if (!flag) {
				$.getJSON('@{Application.unfollowOrganization()}', {
					'organizationId' : id
				}, function(data) {
					document.getElementById("output").innerHTML = "<h3>Saved successfully!</h3>"
					});
			}
		}

		maximum = parseInt(document.getElementById("unfollowedOrgCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkUFO' + i + '').checked;
			$('input:checkbox:checked').val();
			var id = document.getElementById('checkUFO' + i + '').value;
			if (flag) {
				$.getJSON('@{Application.followOrganization()}', {
					'organizationId' : id
				}, function(data) {
				});
			}
		}

		maximum = parseInt(document.getElementById("followedEntCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkFE' + i + '').checked;
			var id = document.getElementById('checkFE' + i + '').value;
			if (!flag) {
				$.getJSON('@{Application.unfollowEntity()}', {
					'entity' : id
				}, function(data) {
				});
			}
		}

		maximum = parseInt(document.getElementById("unfollowedEntCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkUFE' + i + '').checked;
			var id = document.getElementById('checkUFE' + i + '').value;
			if (flag) {
				$.getJSON('@{Application.followEntity()}', {
					'entity' : id
				}, function(data) {
				});
			}
		}

		maximum = parseInt(document.getElementById("followedTopCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkFT' + i + '').checked;
			var id = document.getElementById('checkFT' + i + '').value;
			if (!flag) {
				$.getJSON('@{TopicIdeaController.unfollowTopic()}', {
					'topicId' : id
				}, function(data) {
				});
			}
		}

		maximum = parseInt(document.getElementById("unfollowedTopCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkUFT' + i + '').checked;
			var id = document.getElementById('checkUFT' + i + '').value;
			if (flag) {
				$.getJSON('@{TopicIdeaController.followTopic()}', {
					'topicId' : id
				}, function(data) {
				});
			}
		}

		maximum = parseInt(document.getElementById("followedTagCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkFTA' + i + '').checked;
			var id = document.getElementById('checkFTA' + i + '').value;
			if (!flag) {
				$.getJSON('@{TagPage.unfollowTag()}', {
					'tagId' : id
				}, function(data) {
				});
			}
		}

		maximum = parseInt(document.getElementById("unfollowedTagCounter").value);
		for ( var i = 0; i < maximum; i++) {
			var flag = document.getElementById('checkUFTA' + i + '').checked;
			var id = document.getElementById('checkUFTA' + i + '').value;
			if (flag) {
				$.getJSON('@{TagPage.followTag()}', {
					'tagId' : id
				}, function(data) {
				});
			}
		}

		document.getElementById("followedOrgCounter").value = "0";
		document.getElementById("followedEntCounter").value = "0";
		document.getElementById("followedTopCounter").value = "0";
		document.getElementById("followedTagCounter").value = "0";
		document.getElementById("unfollowedOrgCounter").value = "0";
		document.getElementById("unfollowedEntCounter").value = "0";
		document.getElementById("unfollowedTopCounter").value = "0";
		document.getElementById("unfollowedTagCounter").value = "0";


		setTimeout("a5r()",2500);
	}
function a5r(){
	location.reload(true)
	}

	function replyInvitation(invitationID, replyBoolean) {
		//$('#showRequestsBtn ').fadeIn(1000);
		//$('#requestsDiv').fadeOut(1000);
		//alert(replyBoolean);
		$.getJSON('@{UserProfile.saveDecisionRequest()}', {
			'decision' : replyBoolean,
			'requestId' : invitationID
		}, function(data) {
			javascript: showRequests();
			$('#one').jGrowl(data.result2);
		});
	}
</script>

<script type="text/javascript">
	function fillUserInfo() {
		$
				.getJSON(
						'@{UserProfile.loadUserInfo()}',
						{},
						function(data) {
							if (data != null) {
								document.getElementById('userData').innerHTML = "<h5>Full Name: "
										+ data.fullName
										+ "</h5>"
										+ "<h5>Email: "
										+ data.eMail
										+ "</h5>"
										+ "<h5>Date Of Birth: "
										+ data.dateOfBirth
										+ "</h5>"
										+ "<h5>Ideas Posted: "
										+ data.numberOfIdeasPosted
										+ "</h5>"
										+ "<h5>Comments Posted: "
										+ data.numberOfComments
										+ "</h5>"
										+ "<h5>Mobile Number: "
										+ "0"
										+ data.mobileNumber
										+ "</h5>"
										+ "<h5>Address: "
										+ data.address
										+ "</h5>";
							} else {
								//alert("Cannot load!");
							}
						});
	}
</script>
<script type="text/javascript">
	function removeEmail() {
		document.getElementById("inviteEmail").value = "";
	}
</script>
<script type="text/javascript">
	function invitationSending() {
		//alert((document.getElementById("status2Check").value == "true"));
		if (document.getElementById("status2Check").value == "true") {
			$.getJSON('@{UserProfile.invitationSending()}', {
				'eMail' : document.getElementById("inviteEmail").value
			}, function(data) {
				cancelInviting();
				document.getElementById("output").innerHTML = "<h3>Invitation email sent!</h3>"
			});
		} else {

		}
	}
</script>
<script type="text/javascript">
	var status = document.getElementById("status2");
	var email = document.getElementById("inviteEmail");

	function checkEmail2(email) {
		var regularEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if (regularEmail.test(email) == false) {
			document.getElementById("status2").src = "../../../public/images/no.png";
			document.getElementById("status2Check").value = "false";
			return false;
		} else {
			document.getElementById("status2").src = "../../../public/images/ok.png";
			document.getElementById("status2Check").value = "true";
			return true;
		}
	}
</script>
<script type="text/javascript">
	function checkAlpha(value) {
		var alphaExp = /^[a-zA-Z0-9_s ]*$/;
		var isAllSpace = /^[\s ]*$/;
		if (alphaExp.test(value) == false || isAllSpace.test(value) == true) {
			document.getElementById("alphaStatus").src = "../../../public/images/no.png";
			return false;
		} else {
			document.getElementById("alphaStatus").src = "../../../public/images/ok.png";
			return true;
		}
	}
</script>
<script type="text/javascript">
	function inviteFriend() {
		$('#tableEditing').hide();
		$('#requestsDiv').hide();
		$('#tableInviting').hide();
		$('#inviteWithEmail').fadeOut(1000);
		$('#tableInviting').fadeIn(1000);
	}
</script>

<script type="text/javascript">
	function cancelInviting() {
		$('#inviteWithEmail').fadeIn(1000);
		$('#tableInviting').fadeOut(1000);
	}
</script>
<script type="text/javascript">
	function startEditing() {
		$('#tableEditing').hide();
		$('#requestsDiv').hide();
		$('#tableInviting').hide();
		$('#editUserInformationBtn').fadeOut(1000);
		editUserInfo();
		$('#tableEditing').fadeIn(1000);
	}
</script>
<script type="text/javascript">
	function finishEditing() {
		$('#editUserInformationBtn').fadeIn(1000);
		$('#tableEditing').fadeOut(1000);
	}
</script>
<script type="text/javascript">
	function saveUserInfo(usercurrent) {
		if ((checkAlpha(document.getElementById("addressTextArea").value))
				&& (checkMobile(document.getElementById("mobileNum").value))
				&& (checkEmail(document.getElementById("EmailTextArea").value))) {
			$
					.getJSON(
							'@{UserProfile.saveUserInfoEdited()}',
							{
								'newAddress' : document
										.getElementById("addressTextArea").value,
								'mobileNumber' : document
										.getElementById("mobileNum").value,
								'eMail' : document
										.getElementById("EmailTextArea").value
							}, function(data) {
								javascript: fillUserInfo();
							});
			document.getElementById("output").innerHTML = "<h3>Info Saved!</h3>"
		} else {
			document.getElementById("output").innerHTML = "<h3>Wrong Input!</h3>"
		}
	}
</script>
<script type="text/javascript">
	var status = document.getElementById("status");
	var email = document.getElementById("EmailTextArea");

	function checkEmail(email) {
		var regularEmail = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if (regularEmail.test(email) == false) {
			document.getElementById("status").src = "../../../public/images/no.png";
			return false;
		} else {
			document.getElementById("status").src = "../../../public/images/ok.png";
			return true;
		}
	}
</script>
<script type="text/javascript">
	var status3 = document.getElementById("status3");
	var email3 = document.getElementById("mobileNum");

	function checkMobile(email3) {
		var regularEmail = /^(01)[0-9]{8}/;
		if (regularEmail.test(email3) == false ||email3.length>10 ) {
			document.getElementById("status3").src = "../../../public/images/no.png";
			return false;
		} else {
			document.getElementById("status3").src = "../../../public/images/ok.png";
			return true;
		}
	}
</script>
<script type="text/javascript">
	function editUserInfo() {
		$
				.getJSON(
						'@{UserProfile.editUserInfo()}',
						{},
						function(data) {
							if (data != null) {
								document.getElementById("dropdowndiv").value = data.theme;
								document.getElementById("addressTextArea").value = data.address;
								document.getElementById("mobileNum").value = "0"
										+ data.mobile;
								document.getElementById("EmailTextArea").value = data.email;
								checkMobile(data.mobile);
								checkEmail(data.email);
							} else {
								//alert("Cannot load!");
							}
						});
	}
</script>
<script type="text/javascript">
	function checkForTheUserName() {
		$
				.getJSON(
						'@{UserProfile.isAvailable()}',
						{
							'username' : document
									.getElementById("invitedUsername").value
						},
						function(data) {
							if (data.valid == true) {
								document.getElementById("username2Check").value = "true";
								document.getElementById("usernameCorrect").src = "../../../public/images/ok.png";
								document.getElementById("sendLabel").innerHTML = "<h3>Press send to send the invitation!<h3>";
							} else {
								document.getElementById("username2Check").value = "false";
								document.getElementById("usernameCorrect").src = "../../../public/images/no.png";
								document.getElementById("sendLabel").innerHTML = "<h3>"
										+ data.error + "<h3>";
							}

						});
	}
</script>
<script type="text/javascript">
	function sendFRequest() {
		if (document.getElementById("username2Check").value == "true") {
			$
					.getJSON(
							'@{UserProfile.inviteToBeFriend()}',
							{
								'username' : document
										.getElementById("invitedUsername").value
							},
							function(data) {
								document.getElementById("output").innerHTML = "<h3>Invitation sent!</h3>"
								document.getElementById("sendLabel").value = "Invitation Sent!";
								javascript: checkForTheUserName();
							});
		} else {
			document.getElementById("output").innerHTML = "<h3>Cannot send an invitation!</h3>"
		}
	}
</script>
</head>
<body>
	<div id="content">
		<div id="systemAdminDiv"></div>
		#{if isOrgLead} <a
			href="@{OrganizationLeadFunctionalities.OrganizationLeadView()}">OrganizationLead
			view</a> #{/if}
		<div id="tabs">
			<ul>
				<li><a href="#tabs-1">Notifications</a>
				</li>
				<li><a href="#tabs-2">Edit My Information</a>
				</li>
				<li><a href="#tabs-3">requests</a>
				</li>
				<li><a href="#tabs-7">Friends</a>
				</li>

			</ul>

			<div id="tabs-1">
				<div id="notTabs">
					<ul>
						<li><a href="#notTabs-1">Notifications List</a>
						</li>
						<li><a href="#notTabs-2">Edit Notifications</a>
						</li>
					</ul>
					<div id="notTabs-1">
						<div id="NotificationListB" style="border: 1px solid #f0f0f0;"></div>
						<div id="NotificationListBC"></div>
					</div>
					<div id="notTabs-2">
						<div id="followingDiv"></div>
						<a href='#' onclick="javascript:followThing()">Submit</a>
					</div>
				</div>
			</div>
			<div id="tabs-2">
				<table id="tableEditing" width="88%" border="1">
					<tr>
						<th width="15%" scope="row">Address:</th>
						<td width="56%"><input name="addressTextArea"
							id="addressTextArea" value="" onkeydown="checkAlpha(this.value)"
							type="text" size="50" /><img src="../../../public/images/no.png"
							alt="Status" width="20" height="20" id="alphaStatus"
							style="margin-left: 5px;" />
						</td>
					</tr>
					<tr>
						<th scope="row">Theme:</th>
						<td>&nbsp; <select id="dropdowndiv">
								<option>Regular</option>
								<option>Blue</option>
								<option>Red</option>
						</select>
						</td>

					</tr>
					<tr>
						<th width="15%" scope="row">Mobile:</th>
						<td width="56%"><input name="mobileNum" id="mobileNum"
							value="" type="text" size="45" onkeyup="checkMobile(this.value)" /><img
							src="../../../public/images/no.png" alt="Status" width="20"
							height="20" id="status3" style="margin-left: 5px;" />
						</td>
					</tr>
					<tr>
						<th scope="row">Email:</th>
						<td><input name="EmailTextArea" id="EmailTextArea" value=""
							type="text" size="45" onKeyUp="checkEmail(this.value)"
							onmousedown="checkEmail(this.value)" /><img
							src="../../../public/images/no.png" alt="Status" width="20"
							height="20" id="status" style="margin-left: 5px;" />
						</td>

					</tr>
					<tr>
						<th scope="row"><label id="messsage"></label></th>
						<td width="56%">&nbsp;&nbsp; <a href='#' id="updateAll"
							onclick="javascript:saveUserInfo()">Save</a>&nbsp;&nbsp;<a
							href='#' id="restoreAll" onclick="javascript:editUserInfo()">Restore</a>
							&nbsp;&nbsp;<a
							href="http://localhost:9000/changepassword/changepassword"
							class="frame">Change password</a>
						</td>
					</tr>
				</table>

			</div>
			<div id="tabs-3">
				<div id="requestsDiv"></div>
			</div>
			<div id="tabs-7">
				<div id="notT">
					<ul>
						<li><a href="#notT-1">Invite Friend</a>
						</li>
						<li><a href="#notT-2">Send Friend Request</a>
						</li>
					</ul>
					<div id="notT-1">
						Invited email: <input name="inviteEmail" id="inviteEmail"
							value="write the reciver email here!" type="text" size="45"
							onkeyup="checkEmail2(this.value)"
							onmousedown="removeEmail(this.value)" /> <img
							src="../../../public/images/no.png" alt="Status" width="20"
							height="20" id="status2" style="margin-left: 5px;" /> <input
							type="submit" id="inviteBtn" value=" Invite "
							onclick="javascript:invitationSending()" />
					</div>
					<div id="notT-2">
						Username: <input type="text"
							onkeyup="javascript:checkForTheUserName()" onkeydown="getTagsghUSER(this.value)" id="invitedUsername" />
						<img src="../../../public/images/no.png" alt="Status" width="20"
							height="20" id="usernameCorrect" style="margin-left: 5px;" />
						<button onclick="javascript:sendFRequest()">Invite</button>
						<br />
						<div id="sendLabel"></div>
					</div>
				</div>
			</div>


		</div>
		<div id="output"></div>

	</div>

	<div class="sidebar">

		<img src="/../../../public/images/avatar.jpg" alt="Status" width="150"
			height="150" id="statusImage" style="margin-left: 5px;" /> <br />
		<h3>
			<a href="@{Application.slideShow()}">My Pictures</a>
		</h3>
		<div id="userData"></div>
		<table id="table" width="100%">
		</table>

	</div>

	<input type="hidden" id="followedOrgCounter" value="0" />
	<input type="hidden" id="followedEntCounter" value="0" />
	<input type="hidden" id="followedTopCounter" value="0" />
	<input type="hidden" id="followedTagCounter" value="0" />

	<input type="hidden" id="unfollowedOrgCounter" value="0" />
	<input type="hidden" id="unfollowedEntCounter" value="0" />
	<input type="hidden" id="unfollowedTopCounter" value="0" />
	<input type="hidden" id="unfollowedTagCounter" value="0" />

	<input type="hidden" id="status2Check" value="false" />
	<input type="hidden" id="username2Check" value="false" />
	<input type="hidden" id="notificationCounter" value="0" />

	<div class="clear"></div>
</body>
